home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-01-03 | 46.6 KB | 1,590 lines |
-
-
-
-
-
-
-
-
-
-
- BYE-PC Resident Modem Driver
- with
- DOS Interface
-
- Manual Version 1.0 - February, 1987
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This document describes the operation of BYE-PC and the
- application interfaces required to access functions that control
- modem operations. It is not intended as a reference to 8086
- assembly language or the 'C' programming language, but serves to
- provide a description of the operation and uses of BYE-PC.
-
-
- by
-
- MCODE Software
- 3444 Dresden Drive
- Montgomery, Alabama, 36111
- (205)244-7230
-
-
-
-
-
-
-
-
- Copyright (C) 1986, 1987 MCODE Software
-
- All of the source code is copyrighted material by MCODE
- Software. The author retains all rights to the source code
- provided in this package. This code may not be distributed in any
- modified form without written or verbal consent from the author.
- Any form of sale other than MCODE Software is prohibited. This
- software may not be offered for sale by any means or form to
- others without written permission from MCODE Software.
-
-
-
-
-
-
-
-
-
-
-
-
-
- DISCLAIMER
-
- The author has taken great care to insure that this manual
- and associated software provide accurate information in regards
- to the documentation and source code provided. Any references to
- particular compilers, linkers or other development tools are
- believed to be true by the author. No warranty is made regarding
- the fitness or validity of such material for any circumstance.
- Hardware and software compatibility is not guaranteed for any
- particular types of machines other than those mentioned in this
- manual. This software has been tested extensively under specific
- operating environments and is believed to operate as described
- within this manual. In no event will MCODE software or the
- authors be held liable for damages of any kind, in regard to or
- arising from the use of accompanying software or and documenta
- tion. No representation to the suitablity for this product for
- any use is made by the author.
-
-
- BYE-PC is a Tradmark of MCODE Software. IBM, IBM PC, PC XT,
- PC AT, DOS and PCDOS are Tradmarks of International Business
- Machines Corp. Microsoft C, MSDOS, ASM, and MASM are Tradmarks
- of Microsoft Corp. Hayes, Smartmodem, Smartmodem 300, Smartmodem
- 1200 are trademarks of Hayes Microcomputer Products Inc. CP/M is
- a tradmark of the Digital Research Corp.
-
-
-
-
-
-
- TABLE OF CONTENTS
-
-
- Introduction.........................................
-
- Compiler Information.................................
-
- Configuring BYE-PC for your system...................
-
- BYE-PC Program Structure.............................
-
- Interface to application programs....................
-
- Caller status word...................................
-
- Getting Started......................................
-
- Program Operating structure..........................
-
- Interface functions..................................
-
- Compiling BYE.ASM Source Code........................
-
- Telebit Trailblazer(tm) 9600bps high speed modem.....
- .PA
- INTRODUCTION
-
-
- Welcome to BYE-PC! Your support is greatly appreciated and
- we sincerely thank you for using our product. It is our hope
- that you will benifit and learn from the provided source code. If
- you are an accomplished programmer and already understand the
- operations of interrupt driven software, please send us your
- comments, advice or any other suggestions concerning this
- package. We hope that you will enjoy using this package as much
- as we have in providing it. Contact us if you are having any
- problems setting up the system and we will try to provide you
- with an answer or solution. It is recommended that a $30.00
- donation be made to the author if you use this program on a
- regular basis. Registered users will receive technical support
- only. PLEASE DON'T BOTHER TO CALL IF YOU ARE NOT A REGISTERED
- USER!
-
- MCODE Software will provide all registered users with
- updates for an unlimited period of time. Users that request
- updates will have to provide for any shipping and disk cost at a
- very minimal fee. Also, we plan to keep the latest copies of BYE-
- PC and related programs available for downloads at any time.
- Please keep in touch with us via the Board Walk RBBS distribution
- point in Montgomery, Alabama at (205)277-3882 or write to us at
- MCODE Software. There are still many new features in the making
- and we want you to receive the latest versions as soon as re
- leased.
-
-
- WHAT IS BYE-PC?
-
- BYE-PC is a memory resident modem driver that is interrupt
- driven to provide fast reliable serial communications with phone
- modems. BYE-PC is a complete implementation of the BYE CP/M
- version offered in the public domain for use on eight bit
- systems. The CP/M implementation does not support rs232 driven
- interrupts and is much slower than BYE-PC. BYE-PC allows for full
- keyboard type ahead from the remote station. Characters may be
- received during other processes without polling the receive port
- for a data ready signal.
-
- Please be sure and read the supplementary documentation
- files that exsists. These files contain important information on
- recent updates that may have occured:
-
- READ.ME ---- Latest modifications
-
- Any recent modifications that occur since the last manual publi
- cation, are contained in the file READ.ME. Please read the copy
- right notice and license agreement in the file COPYRGHT.BYE.
- .PA
- WHAT WILL BYE-PC DO?
-
- An IBM PC, PC XT, or PC AT host computer running BYE-PC
- allows a remote callers access to DOS. A series of interrupts are
- overtaken and/or chained that patch the modem i/o signals into
- the BIOS. Since DOS makes calls through the BIOS, almost any
- program that does not access the serial port or screen directly
- will run under BYE-PC. Although the large majority of programs do
- not adhere to these rules, most programs that are well behaved
- and write to 'stdin' and 'stdout' will run properly under BYE-PC.
- For instance, DEBUG may run remotely to allow viewing the system
- internally, or file archive utilities such as ARC, ZOO, etc...,
- may be used.
-
- Once a caller has established a connection, BYE-PC allows the
- option to execute a .COM or .EXE file. This allows any number of
- programs, such as bulletin boards, to receive control before
- allowing users to enter DOS. Since any DOS commands may be exe
- cuted while running BYE-PC, users have complete control. A
- security shell is provided that parses all DOS commands prior to
- execution by COMMAND.COM. This allows selective commands to check
- internal status before execution to eliminate unwanted commands,
- paths, drives or DOS functions.
-
- Currently all application programs that provide access to
- BYE-PC such as XMODEM, CHAT, STAT, and RBBS, are created using
- the Microsoft C compiler. A standard interface is provided that
- allows C programs direct control over the host system. An
- application may disconnect, check status, or change values
- within BYE-PC through an additional software interrupt. Assembly
- language routines may call BYE-PC functions as easily as C
- applications through the system control interrupt (SCI).
-
- Since all data is received from hardware interrupts,
- characters are stored in a buffer within BYE-PC as each interrupt
- occurs. All requests for data are made through the SCI and the
- provided C interface BYEXFACE.C. These topics are covered in
- greater detail in the following sections of this manual. Hardware
- interrupts occur with changes of state in the rs-232 serial
- port card. In the event of a carrier loss, an interrupt is
- generated that warm boots the system to prepare for the next
- call.
- .PA
- COMPILER INFORMATION
-
- Currently, all of our assembly and C source code modules are
- compiled using Microsoft Compilers. We feel that these compilers
- are amoung some of the best available for the PC market and
- strongly recommend their use with our packge. We have not used
- any other C compilers or assemblers available on the market to
- compile our code with. Since the C language for 8086 based
- machines varies so widely in its library extensions, it would be
- very difficult to adapt the code to all versions.
-
- Either MASM or ASM may be used to compile BYE-PC directly.
- Once the .OBJ file is created, LINK and EXE2BIN are then used to
- create the resulting .COM file. Version 3.0 or 4.0 of the C
- compiler will compile all C modules in any of the available
- memory models with without difficulties. MASM is required on all
- of the assembly modules used in conjuntion with C programs. The
- file MODEL.H contains the macros used to setup the C environment
- needed for all assembly language files. If you develop any
- assembly source code, we strongly recommend using MODEL.H in all
- of the modules to set up the segments and pointers argument list.
-
- Any C compiler that suports access to software interrupts
- should work with BYE-PC. All modem i/o, modem control, modem
- status, and line control are performed through software interrupt
- 66h. If your compiler supports this feature, only the interface
- functions should require changes. All application programs
- provided in this package are device independant. All of the modem
- functions are dependant upon BYEXLIBx.LIB to provide the necces
- sary interface functions. These libraries contain all of the
- functions needed to access BYE-PC functions within C programs.
-
- How to compile BYEx.xx.ASM:
-
- 1) Compile .ASM source code using ASM
-
- 2) Link using LINK to generate and .EXE file
-
- 3) use EXE2BIN to convert to a .COM file
-
- 4) delete the .EXE extension file
-
- Using MAKE:
-
- C>make bye {return}
-
- A MAKE file 'BYE' is provided to automatically link the
- object code and produce the .COM file. This will also delete the
- copy of the .EXE file since it is of no use. Once the BYExxx.COM
- file is generated, rename it to BYE.COM and place it in the root
- directory of the RBBS system disk.
- .PA
- CONFIGURING BYE-PC FOR YOUR SYSTEM
-
-
- In order to run BYE-PC on your system you will need the
- appropriate modem and serial port for you system. A standard DCE
- configuration port is required to the modem. This port must be
- configured for COM1 using IRQ4 or, COM2 using IRQ3 respectivly.
- Almost all serial cards availble for PC's will be configured in
- this fashion at purchase and should not require altering. If you
- are not sure of you boards configuration, consult you serial port
- manual and check the jumper locations on you board.
-
- A Hayes Smartmodem(tm) with AT command sets is required to
- work with BYE-PC or a manual modem such as a Universal Data
- Systems 212B. If a manual modem is used, BYE-PC will monitor the
- data carrier detect (DCD) to determine when a call occurs. Once
- carrier is acknowledged, BYE-PC will begin switching baud rates
- of the port and looking for a sycronization character (carriage
- return or Ctrl-C). Smart modems return a result code that informs
- BYE-PC of the baud rate currently on line.
-
- Configuring BYE-PC is basically a matter of setting the
- various equates in the source code file BYExx.x.ASM. All of these
- equates are found after the title 'program configuration section'
- of the source code file. If you choose to execute a .COM or .EXE
- file upon receiving a valid carrier, you will need to edit the
- path/file name at the end of the source code listing at the label
- 'child name'. You may enter a full path/drive name if needed
- here, however, make sure it not over 63 characters in length. The
- following sections expains the various equate settings.
-
- .PA
- Selecting a COM port
-
- BYExx.x is configured to use COM1 on the distribution disk.
- However, may alter this to COM2 by changing the following
- three equates:
-
-
- RS232_INT - This is used to select the interrupt vector
- location. COM1 uses interrupt vector 0Ch, while
- COM2 requires interrupt location 0Bh.
-
- IRQ_BASE - This is the interrupt request register base port
- address. COM1 (IRQ4) uses i/o address 10h, while
- COM2 (IRQ3) uses i/o port 08h.
-
- PORT_BASE - This is the 8255 serial i/o port base address.
- COM1 is at 03F8h, and COM2 is at address 02F8h
-
-
-
- Selecting Modem Type
-
- If you are using a smart modem, you will need to make sure
- the equate SMART_MDM is set to YES. The next three equates are
- used to describe the highest baud rate your modem supports.
- Select ONE of the equates labeled BPS_300, BPS_1200, or BPS_2400
- and set it to YES. If you wish to use BYE-PC with a high speed
- modem, the Telebit Trailblazer(tm) modem will support
- transmission speed in excess of 18k bps with a maximum throughput
- of 9600 baud. If you have a Trailblazer, set the TELEBIT and
- USE_RTS equates to YES.
-
- The Trailblazer(tm) requires handshaking via RTS and CTS to
- provide flow control. Since the possiblity exists for data to
- overflow the receive queue, handshaking is required for reliable
- operation. If the receive data queue becomes full, RTS is
- asserted low until the receive data queue is 1/4th full of the
- total queue size. This allows BYE-PC to catch up with the modem
- receive data until it can accept more data.
-
-
- Sending 'nulls' to Remote
-
- If you do not have a 2400bps modem, you may want to disable
- this feature. If enabled, this will send the requested number of
- nulls (0 to 9) after a line feed is recevied. This feature is
- mainly a leftover from the teletype days, but it is still used by
- high speed callers. This allows the remote end to settle after a
- line feed before sending any other data on a new line.
-
-
- Executing a Program on Carrier Detect
-
- If you wish to execute a program, such as a bulletin board
- service, upon carrier detect, set the LOGON_EXE equate to YES.
- You will have to set the drive/path/file name at the end very end
- of the source code. The default value is "A:SYSTEM\XBBS\XBBS.EXE"
- for the source code mailed out. If LOGON_EXE is set to YES, BYE-
- PC will attempt to execute this program from drive A:. If it is
- not found, an error message is displayed and control is
- transferred to DOS.
-
-
- Warm Booting After Local Execute
-
- The equate NBOOT is used mainly for debugging applications
- that run under BYE-PC such as bulleting board system. If this
- equate is set to YES, BYE-PC will re-boot after pressing Ctrl-C
- and running the LOGON_EXE file locally. If NO, BYE-PC will not
- re-boot but cut off data sent to and from the modem and allow
- entry into DOS. This allows BYE-PC to remain resident, but not
- send or receive any data from the modem. This is a very useful
- feature for debugging application programs that run under XBBS
- such as XBBS. You may perform any operations in DOS, except
- loading other resident programs, that you normally use while
- creating applications to run under BYE-PC (i.e. editing,
- compiling, etc..).
-
-
- Setting the Default Time Limit
-
- The default time limit for callers initially is set for 60
- minutes. This is usually set to by XBBS or other programs,
- however, before allowing entry into DOS or upon logging on the
- system. The equate TIME, allows setting the initial time allowed
- on the system per caller. You may set this value to 0 if you wish
- unlimited time per call.
- .PA
- Special Function Keys
-
- BYE-PC has several special ALT function keys. These keys
- allow direct control over all programs operating under BYE-PC.
- These keys are mapped as follows:
-
- ALT-B Toggles the remote caller on/off while in
- DOS. If off, no data is sent or received
- from the remote.
-
- ALT-C Displays Caller online when using XBBS.
-
- ALT-O Send 'system going down in 2 min(s)' msg.
- This is used to tell the caller to log off.
-
- ALT-H Hangup on the caller and re-boot system.
-
- ALT-Q Enter 'message from sys/op' mode. This dis-
- ables data from the remote, and allows the
- sys/op to type a message to the remote. To
- exit, press ESC or the [End] key.
-
- ALT-Z Clear the screen locally.
-
- ALT-U Gives the caller online unlimited time for
- session active.
-
- ALT-S Temporarily gives a caller sys/op privledges
- by setting the CSW to ffffh.
-
- These keys may be re-mapped if you wish by setting the
- K_{function} keys to different ALT_c keys. Simply change the
- equates to reflect the new ALT_c keys. Be careful not to cause
- any conficts in changing these keys if you must change them.
- Normally you should not have to change any of these values.
- .PA
- BYE-PC interface via INT 66
-
-
- BYE-PC provides all functions needed to support modem
- control and i/o functions used by application programs that run
- under BYE-PC. The most common program to run under BYE-PC is
- XMODEM. XMODEM requires many interface functions for modem
- control and data i/o transfer. The accompanying source code on
- disk 1, BYEXFACE.C, contains all of the funcions needed to
- support C applications under BYE-PC. Make a listing of all of the
- source code and study the functions carefully. This is used by
- all C programs for modem control and i/o.
-
- These functions can be called from most any language that
- allows access to software interrupts. Assembly language allows
- the most direct control of software interrupts. BYE-PC currently
- uses software interrupt 66h for all modem control and i/o
- functions. The following is a complete list of all INT 66h
- functions currently provided by BYE-PC:
-
- -----------------------------------------------------------------------
- INT66 APPLICATIONS PROGRAM INTERFACE (API) -- This interrupt provides
- modem i/o for applications which need direct control of the modem.
-
- Altered registers : AX, BX, CX, DX
- ES (only when funct 21 called)
-
- Preserved registers: CS, DS, SS, DI, SI, SP, BP
-
- -----------------------------------------------------------------------
-
- Functions Provided:
-
- AH=0 Get character from modem in AL.
- AL=character returned
- AH=0 null (no keybd scan codes)
- AX = EOF if no data.
-
- AH=1 Put character in AL to modem.
- AL=character to send.
-
- AH=2 Hang up the modem (DTR off):
- AL=0 turn off dtr
- AL=1 turn on dtr
-
- AH=3 Get carrier detect status in AX:
- AX=0 no carrier detect found
- AX=1 carrier detect found
-
- AH=4 Set carrier detect check status:
- AX=0 ignore carrier detect status
- AX=1 check carrier detect status
-
- AH=5 Flush the rx queue of all data.
- .PA
- AH=6 Get # of chars in rx queue:
- AX=0 rx queue size
-
- AH=7 Get Baud rate of this call in AX:
- (0=300bps, 1=1200bps, 3=2400bps)
-
- AH=8 Set Control Break/Pause (CTRL-C/CTRL-S) flag state:
- AL=0 CTRL_NOBRK - disable remote ^C & ^S breaks
- AL=1 CTRL_BRK - enable remote breaks
- AL=2 CTRL_NOTOUT - disable ^S pause timeout
- AL=3 CTRL_TOUT - enable ^S timeout
- AL=4 CTRL_NOTRAP - dont trap ^C & ^S characters
- AL=5 CTRL_TRAP - allow ^C & ^S to be trapped out
-
- AH=9 Set <stdout> merged with modem:
- AL=0 disable output modem
- AL=1 enable output to modem
-
- AH=10 Set <stdin> merged with modem:
- AL=0 disable input from modem (rx-queue active)
- AL=1 enable input from modem (rx-queue active)
-
- AH=11 Get BYE-PC version/revison level in AX:
- AL=Current Revision level
- AH=Current Version level
-
- AH=12 Get number of nulls requested in AX:
- AX=Number of nulls requested
-
- AH=13 Set number of nulls to AX:
- AL=Number of nulls to send
-
- AH=14 Warm Boot the system through bios Ctrl-Alt-Del.
-
- AH=15 Get the user caller status
- AX=Status level (0-FFFFh).
-
- AH=16 Set the user caller status
- CX=Status level (0-FFFFh).
-
- AH=17 Set the time limit caller is allowed on line.
- AL=number of minutes (0-255, 0=Unlimited).
-
- AH=18 Get the time caller has been on line
- AX=number of minutes online (0-255).
-
- AH=19 Set the receive data interrupt mode
- AL=Mode (0=Off, 1=On)
-
- AH=20 Get the time limit caller is allowed on line.
- AX=number of minutes allowed online (0-255).
-
- AH=21 Get far pointer to caller name buffer.
- ES:BX -> far ptr to name buffer
- .PA
- AH=22 Get far pointer to terminal configuration buffer
- ES:BX -> far ptr to terminal config buffer
-
-
-
- CALLER STATUS WORD STRUCTURE
-
-
- The caller status word is a sixteen bit word used by SHELL, XMDM,
- and other application programs to check for command priorities which
- are set by an RBBS program before the user can enter DOS. The MSW of
- the status word bits have been reserved for any applications that
- may be developed in the future. The LSW bits have the followine
- meaning:
-
- CSW (Caller status word):
-
- {LSW (least significant word)}
-
- ----MSB---- ----LSB----
- D7 D6 D5 D4 D3 D2 D1 D0
- | | | | | | |---|--- {reserved for future use}
- | | | | | |---------- PATH restriction disable.
- | | | | |------------- CD command allowed enable.
- | | | |----------------- XMDM S {file} allowed.
- | | |-------------------- XMDM R {file} allowed.
- | |----------------------- Shell DOS command allowed.
- |-------------------------- Shell EXIT command allowed.
-
-
- {MSW (most significant word)}
-
- ----MSB---- ----LSB----
- D7 D6 D5 D4 D3 D2 D1 D0
- {unused} | | | |
- |--|--|--|--- Max Drive allowed (0-15).
-
-
-
- The settings of the CSW has no effect upon BYE-PC
- operations, it is intended for use as a global flag word which
- various applications may refer to. This allows any number of
- applications running under BYE-PC to check status levels set by
- other programs before performing an operation. Its main purpose
- is to inform XMODEM and SHELL if a user has sufficient status to
- perform file transfers or change directories/paths.
-
- .PA
- BYEXLIXs.C Interface Functions
-
- The following pages describe each function provided in
- BYEXLIBx.C and how to use each one. This is provided as a quick
- reference when developing code that use BYE-PC control or i/o
- functions. Do not attempt to address the serial port either
- directly or through the BIOS in any application program. This
- will cause severe problems with the interrupts and very likly
- crash the system. The following libraries contain the modules for
- all memory models supported by MSC:
-
- BYEXLIBS.LIB {small memory model}
- BYEXLIBM.LIB {medium memory model}
- BYEXLIBC.LIB {compact memory model}
- BYEXLIBL.LIB {large memory model}
-
- All of the source code in these library files requires MASM 5.0
- to create. This version contatins macros which allow easy
- creation of assembly modules for use with MSC.
-
- All applicactions must use INT66 for all modem control and
- i/o for data transfer. XMDM.C provided with the development
- package shows how to use BYE-PC interrupt functions in detail.
- You may wish to develop your own interface in Pascal or other
- language however. If you develop an interface module for another
- lauguage than C, please contact us if you wish to make it
- available to other programers of BYE-PC applications.
-
-
-
-
-
-
-
- 'BYEXLIBx.LIB'
-
- FUNCTIONS DESCRIPTION
-
- FOR MSC 3.0, 4.0, & 5.0
-
-
-
-
-
-
-
-
-
-
- NOTE: These functions describe BYEXLIBx.LIB version 2.00. Any
- previous versions released are no longer in use.
-
- FUNCTION: int _bye_check(lver, hver, lrev, hrev)
-
- PARAMETERS: int lver, hver; lowest/highest version
- int lrev, hrev; lowest/highest revision
-
- PURPOSE: Allows checking to ensure that BYE-PC is loaded
- and resident in memory and of the correct version
- and revision level. This function must be called
- before any '_bye' functions are called or, a hard
- system crash will result and require power down to
- reload the system.
-
- RETURN: 0 = BYE-PC loaded and is an acceptable version
- 1 = BYE-PC is not loaded yet
- 2 = BYE-PC is loaded but, invalid version#
- 3 = BYE-PC is loaded but, invalid revision#
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- #define MIN_VER 1 /* minimum BYE-PC version# required */
- #define MIN_REV 2 /* minimum BYE-PC revision# required */
- #define MAX_VER 9 /* maximum BYE-PC version# allowed */
- #define MAX_REV 99 /* maximum BYE-PC revision# allowed */
-
- main() /* must at least be version 1.02 */
- { /* but, any version after and up */
- int rtn; /* to 9.99 will work. */
-
- if ((rtn = _bye_check(MIN_VER, MAX_VER, MIN_REV, MAX_REV)) != 0)
- {
- printf("\nERROR: BYE-PC ");
- switch(rtn)
- {
- case 1:
- printf("is not loaded!\n");
- break;
- case 2:
- printf("loaded is the wrong Version!\n");
- break;
- case 3:
- printf("loaded is the wrong Revision!\n");
- break;
- default:
- printf("returned invalid error code!\n");
- break;
- }
- exit(1);
- }
-
-
-
-
- FUNCTION: int _bye_getc()
-
- PARAMETERS: void
-
- PURPOSE: Returns a character from the receive data queue if
- avilable. This is for directly reading a a stream
- of data from the modem. Make sure that data sent
- and received from the screen/keyboard is off
- before using _bye_getc() and _bye_putc().
-
- RETURN: Returns an 8 bit character from the receive data
- queue. If no data is available an EOF value is
- returned.
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /*
- ** Collect a 128 bytes of binary data from the receive queue.
- ** This function will not return until all data has been
- ** received. Before we can receve the data we must disable
- ** data sent to the screen and key presses from going to
- ** the modem. We must also disable trapping of ^S and ^C
- ** so that they may pass a valid binary data characters.
- */
-
- main()
- {
- char buf[140];
- int i;
-
- _bye_setbreak(CTRL_NOTRAP); /* dont trap/filter ^C & ^S data */
- _bye_stdout(0); /* turn on console Rx & Tx */
- _bye_stdin(0);
-
- for(i = 0; i < 128; i++) /* read 128 bytes of data */
- {
- while(!_bye_rxsize()) /* wait for data to appear */
- ;
- buf[i] = _bye_getc(); /* place data in buffer */
- }
-
- _bye_stdin(1); /* turn on console Rx & Tx */
- _bye_stdout(1);
- _bye_setbreak(CTRL_TRAP); /* enable trap ^C & ^S data */
- exit(0); /* exit back to DOS */
- }
-
-
-
-
-
-
- FUNCTION: int _bye_putc(c)
-
- PARAMETERS: int c; character to transmit to modem
-
- PURPOSE: Transmit the character 'c' to the modem . A return
- return value of EOF indicates a serious error.
- Either the serial port is defective, the modem is
- no longer functioning or a cable problem exists.
-
- RETURN: EOF = Transmit timeout error
- 0 = Character transmitted.
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /*
- ** Disable the remote callers ^S and ^C keys and send a string
- ** to the remote caller. This will prevent the caller from
- ** being able to pause or break the program from running. Note,
- ** however, that the local console can still press Ctrl-Break
- ** and stop the program. Carefully coded applications should
- ** trap for Ctrl-Break on the local keyboard as well.
- */
-
- main()
- {
- char buf[64];
- int i;
-
- _bye_setbreak(CTRL_NOTRAP); /* dont trap/filter ^C & ^S data */
- strcpy(buf, "This a string from BYEXFACE ....\n");
-
- for(i = 0; i < strlen(buf); i++) /* send for string len */
- _bye_putc((int)buf[i]); /* send a byte of data */
-
- _bye_setbreak(CTRL_TRAP); /* enable trap ^C & ^S data */
- exit(0); /* exit back to DOS */
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- FUNCTION: int _bye_dtr(f)
-
- PARAMETERS: int f; toggle dtr line (0=inactive, 1=active)
-
- PURPOSE: This function is used to hangup the modem by
- toggling the DTR/CTS line to the modem.
-
- RETURN: void
-
-
-
- FUNCTION: int _bye_warmboot()
-
- PARAMETERS: void
-
- PURPOSE: Hangup on the caller and warm boot the system
- via Alt-Ctrl-Del bios routine. This causes
- BYE-PC to turn execution over to the BIOS for
- a system re-boot. Note that this function calls
- _bye_dtr() before warm booting to ensure that
- the modem is hung up.
-
- RETURN: void
-
-
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- main()
- {
- printf("\n\nGoodbye...Please Call Again...\n\n");
-
- _bye_warmboot();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- FUNCTION: int _bye_getcd()
-
- PARAMETERS: void
-
- PURPOSE: This function is used to hangup return the stat-
- us of the carrier detect (CD) line to the modem.
- This is used to test for carrier detect while
- carrier check is disabled. This allows checking
- for carrier while writing to disk files with
- carrier check disabled via _bye_setcd().
-
- NOTE: This use rs-232 pin 20 to check from the
- modem and it must be connected for this function
- to operate properly.
-
- RETURN: 0 = no carrier detect found
- 1 = carrier detect found (CD).
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /*
- ** display the current status of the carrier detect line
- */
-
- main()
- {
- rtn = _bye_getcd(); /* read CD status line */
- if (rtn)
- printf("Carrier Found...\n");
- else
- printf("No Carrier Found...\n");
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- FUNCTION: void _bye_setcd(f)
-
- PARAMETERS: int f; (0=ingnore CD, 1=re-boot if CD false)
-
- PURPOSE: This function is used to disable carrier checking
- from the modem. It's main purpose is to prevent
- the system from re-booting while writing to a file
- on disk. Carrier checking should be disabled and
- checked via '_bye_getcd()' while writing to disk.
-
- RETURN: void
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /* Open file 'temp.dat' and fill it with 1k of binary data.
- ** Make sure that the system does not re-boot if carrier is
- ** lost while writing to disk.
- */
-
- main()
- {
- int i, c;
- FILE *fp;
-
- if ((fp = fopen("TEST.DAT", "wb")) == NULL)
- exit(1);
- _bye_setbreak(CTRL_NOTRAP);
- _bye_setcd(0); /* disable carrier checking */
- _bye_stdin(0);
- _bye_stdout(0);
- for (i = 0; i < 1024; i++) /* write 1k of data */
- {
- while(!_bye_rxsize() && _bye_getcd());
- if (!_bye_getcd()) /* check for carrier good */
- {
- printf("\n** CARRIER LOST - CLOSING FILE **\n");
- break;
- }
- else
- {
- c = _bye_getc(); /* get a character */
- fprintf(fp, "%c", c); /* write to disk */
- }
- }
- fclose(fp); /* now close the file */
- _bye_setcd(1); /* re-enable carrier checking */
- _bye_setbreak(CTRL_TRAP);
- _bye_stdin(1);
- _bye_stdout(1);
- }
-
-
- FUNCTION: void _bye_rxflush()
-
- PARAMETERS: void
-
- PURPOSE: This function clears all data from the rx-queue
- and resets the count to zero.
-
- RETURN: void
-
-
-
- FUNCTION: int _bye_rxsize()
-
- PARAMETERS: void
-
- RETURN: Size of receive data queue.
-
- PURPOSE: Returns the size of the receive data queue in
- bytes. The maximum size of the receive data queue
- depends on the configuration BYE-PC.
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /* Allow a 128 bytes of data to collect in the receive data
- ** queue and move it to a local buffer for checksum calculation.
- */
-
- main()
- {
- int i;
- unsigned checksum;
- char buf[130];
-
- _bye_rxflush(); /* make sure rx-queue is empty */
- _bye_setbreak(CTRL_NOTRAP);
- _bye_stdin(0); /* disable screen & keybd patch */
- _bye_stdout(0);
-
- while(_bye_rxsize() < 128); /* let 128 bytes collect */
- for (i = 0; i < 128; i++) /* move it to buffer */
- buf[i++] = _bye_getc();
-
- checksum = 0; /* compute checksum */
- for (i = 0; i < 128; i++)
- checksum += buf[i];
-
- _bye_stdin(1); /* re-enable screen & keybd merge */
- _bye_stdout(1);
- _bye_setbreak(CTRL_TRAP);
- }
-
-
- FUNCTION: int _bye_baud()
-
- PARAMETERS: void
-
- PURPOSE: Returns the baud rate of the call on line. When
- BYE-PC logs on a caller, the baud rate is de-
- termined and stored for access by '_bye_baud()'.
- This is mainly used for calculating file trans-
- mission times for file transfer protocols.
-
- RETURN: 0 = 300 bps
- 1 = 1200 bps
- 2 = 2400 bps
- 3 = 9600 bps
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /*
- ** Display the baud rate of the caller presently on line
- */
-
- main()
- {
- int bps;
-
- switch(_bye_baud()) /* get baud rate from BYE */
- {
- case 0:
- bps = 300;
- break;
- case 1:
- bps = 1200;
- break;
- case 2:
- bps = 2400;
- break;
- default:
- bps = 9600;
- break;
- }
- printf("\nBaud Rate for this call: %d bps\n", bps);
- }
-
-
-
-
-
-
-
-
-
-
- FUNCTION: void _bye_setbreak(f)
-
- PARAMETERS: int f; (break state flag)
-
- Valid States:
-
- CTRL_NOBRK = 0 -> ignore ^C and ^S keys from remote
- CTRL_BRK = 1 -> check for ^C and ^S keys
- CTRL_NOTOUT = 2 -> disable 1 min timeout on ^S
- CTRL_TOUT = 3 -> enable 1 min timeout on ^S
- CTRL_NOTRAP = 4 -> disable all key trapping (^C & ^S).
- CTRL_TRAP = 5 -> enable key trapping (^C & ^S).
-
- PURPOSE: This function is used to control ^S & ^C keys from
- the remote caller and to disable timeout on ^S.
- This function must be disabled before transferring
- binary files, to prevent ^S and ^C data from
- being interpretted.
-
- RETURN: void
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- main()
- {
- int i, c;
- FILE *fp;
-
- if ((fp = fopen("TEST.DAT", "wb")) == NULL)
- exit(1);
- _bye_setbreak(CTRL_NOTRAP); /* dont trap ^C & ^S */
- _bye_setcd(0); /* disable carrier checking */
- for (i = 0; i < 1024; i++) /* write 1k of data */
- {
- while(!_bye_rxsize() && _bye_getcd());
- if (!_bye_getcd()) /* check for carrier good */
- {
- printf("\n** CARRIER LOST - CLOSING FILE **\n");
- break;
- }
- else
- {
- c = _bye_getc(); /* get a character */
- fprintf(fp, "%c", c); /* write to disk */
- }
- }
- fclose(fp); /* now close the file */
- _bye_setcd(1); /* re-enable carrier checking */
- _bye_setbreak(CTRL_TRAP);
- }
-
-
- FUNCTION: void _bye_stdin(f)
-
- PARAMETERS: int f; (bios keyboard rx-data merge flag)
- (1=data rx'ed merged to stdin)
- (0=data rx'ed is not merged)
-
- PURPOSE: This function is used to control merging data
- to the keyboard at the bios level. All modem data
- received is treated the same as keys pressed at
- the local keyboard. This is provided to disable
- the INT16 bios patch so data can be transferred.
-
- RETURN: void
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /* Allow a 128 bytes of data to collect in the receive data
- ** queue and move it to a local buffer for checksum calculation.
- */
-
- main()
- {
- int i;
- unsigned checksum;
- char buf[130];
-
- _bye_rxflush(); /* make sure rx-queue is empty */
- _bye_setbreak(CTRL_NOTRAP);
- _bye_stdin(0); /* disable screen & keybd patch */
- _bye_stdout(0);
-
- while(_bye_rxsize() < 128); /* let 128 bytes collect */
- for (i = 0; i < 128; i++) /* move it to buffer */
- buf[i++] = _bye_getc();
-
- checksum = 0; /* compute checksum */
- for (i = 0; i < 128; i++)
- checksum += buf[i];
-
- _bye_stdin(1); /* re-enable screen & keybd merge */
- _bye_stdout(1);
- _bye_setbreak(CTRL_TRAP);
- }
-
-
-
-
-
-
-
-
-
- FUNCTION: void _bye_stdout(f)
-
- PARAMETERS: int f; (bios screen tx-data merge flag)
- (1=data sent to screen tx'ed)
- (0=data sent to screen not tx'ed)
-
- PURPOSE: This function is used to control merging data
- sent to the screen. If enabled, all characters
- printed to the screen via INT10 TTY, are sent
- to the modem as well. If disabled, prints to
- stdout are sent to screen only.
-
- RETURN: void
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /* Allow a 128 bytes of data to collect in the receive data
- ** queue and move it to a local buffer for checksum calculation.
- */
-
- main()
- {
- int i;
- unsigned checksum;
- char buf[130];
-
- _bye_rxflush(); /* make sure rx-queue is empty */
- _bye_setbreak(CTRL_NOTRAP);
- _bye_stdin(0); /* disable screen & keybd patch */
- _bye_stdout(0);
-
- while(_bye_rxsize() < 128); /* let 128 bytes collect */
- for (i = 0; i < 128; i++) /* move it to buffer */
- buf[i++] = _bye_getc();
-
- checksum = 0; /* compute checksum */
- for (i = 0; i < 128; i++)
- checksum += buf[i];
-
- _bye_stdin(1); /* re-enable screen & keybd merge */
- _bye_stdout(1);
- _bye_setbreak(CTRL_TRAP);
- }
-
-
-
-
-
-
-
-
-
- FUNCTION: unsigned _bye_vers()
-
- PARAMETERS: void
-
- PURPOSE: Return the version/revison level of BYE-PC
- currently running.
-
- RETURN: lsb = revision number
- msb = version number
-
-
-
- FUNCTION: void _bye_version(ver, rev)
-
- PARAMETERS: int *ver, *rev; (buffers to place version in)
-
- PURPOSE: Sets the version/revison level of BYE-PC in the
- int buffer addresses passed.
-
- RETURN: void
-
-
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /*
- ** Ask BYE-PC for the version number currently operating.
- */
-
- main()
- {
- int rev, ver;
- unsigned x;
-
- /* try the hard way first.... */
-
- x = _bye_vers();
- ver = (int)(x >> 8);
- rev = (int)(x & 0x00ff);
- printf("\nBYE-PC Version %1d.%-2.2d\n", ver, rev);
-
- /* or use '_bye_version()' for easier access */
-
- _bye_version(&ver, &rev);
- printf("\nBYE-PC Version %1d.%-2.2d\n", ver, rev);
- }
-
-
-
-
-
-
- FUNCTION: int _bye_getnulls()
-
- PARAMETERS: void
-
- PURPOSE: Return the number of nulls presently active. This
- causes BYE-PC to send 'n' (0-9) to the remote
- station after each feed (LF) printed through the
- BIOS write to video INT10.
-
- RETURN: Number of nulls active 0 through 9.
-
-
-
- FUNCTION: void _bye_setnulls()
-
- PARAMETERS: void
-
- PURPOSE: Sets the number of nulls sent to the remote after
- each line feed printed.
-
- RETURN: void
-
-
-
- EXAMPLE:
-
- #include <stdio.h>
- #include <conio.h>
- #include "byexface.h"
-
- /*
- ** Ask BYE-PC for the number of nulls active and ask the user
- ** what to set it too.
- */
-
- main()
- {
- int n;
-
- n = _bye_getnulls();
- printf("\nCurrent Nulls Setting: d\n", n);
-
- printf("\nEnter new value <RET=0>: ");
- n = getch();
- if (n >= '0' && n <= '9')
- {
- n -= '0'
- _bye_setnulls(n);
- }
- printf("\nNulls Set to %d\n", _bye_getnulls());
- }
-
-
-
-
- FUNCTION: int _bye_getcsw()
-
- PARAMETERS: void
-
- PURPOSE: Return the present caller status word (CSW)
- setting. (Refer to CSW section of manual).
-
- RETURN: 16 bit CSW
-
-
-
- FUNCTION: void _bye_setcsw(s)
-
- PARAMETERS: int s; (16 bit caller status word)
-
- PURPOSE: Sets the caller status word to a new value.
-
- RETURN: void
-
-
-
- EXAMPLE:
-
- #include <stdio.h>
- #include <conio.h>
- #include "byexface.h"
-
- /*
- ** Read the CSW and display the present status, then enable file
- ** transmit and receive flags.
- */
-
- #define B_FILE_TX 4
- #define B_FILE_RX 8
-
- main()
- {
- int s;
-
- s = _bye_getcsw();
- printf("\nOld Caller Status Word: %-4.4x\n", s);
-
- /* set transmit and receive flags */
-
- s = s | B_FILE_TX | B_FILE_RX;
- _bye_setcsw(s);
-
- printf("\nNew Caller Status Word: %-4.4x\n", s);
-
- printf("\nFILE Transmit/Receive Enabled...\n");
- }
-
-
-
-
- FUNCTION: int _bye_gettimer()
-
- PARAMETERS: void
-
- PURPOSE: Return the number of minutes caller has been on
- line and since carrier detect was acknowleged.
-
- RETURN: number of minutes online (0-255)
-
-
-
- EXAMPLE:
-
- #include <stdio.h>
- #include <conio.h>
- #include "byexface.h"
-
- /*
- ** Tell caller how long he has been online and how much time
- ** is remaining.
- */
-
- main()
- {
- int l, t;
-
- l = _bye_gettimeon(); /* original time limit */
- t = _bye_gettimer(); /* time already used */
-
- if (!l)
- printf("\nUnlimited Time...\n");
- else
- {
- printf("\nMaximum Time Allowsd: %u\n", l);
- printf("\nMinutes Since Logon : %u\n", t);
- printf("\nTime remaining : %u\n", t - l);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- FUNCTION: void _bye_settimeon(mins)
-
- PARAMETERS: int minutes; (0-255 max time limit, 0=unlimited)
-
- PURPOSE: Set the time in minutes that the caller may re-
- main on line. The time limit becomes effective
- as soon as this function is called. If the time
- limit is set to 0, the time limit is unlimited.
-
- RETURN: void
-
-
-
- FUNCTION: int _bye_gettimeon()
-
- PARAMETERS: int minutes; (0-255 max time limit, 0=unlimited)
-
- PURPOSE: Return the original time limit value set by
- _bye_settimeon(). This value is not decremented
- by the system timer, this only allows you to
- read what the time limit was set to.
-
- RETURN: void
-
-
- EXAMPLE:
-
-
- #include <stdio.h>
- #include <conio.h>
- #include "byexface.h"
-
- /*
- ** Tell caller how long he has been online and set the limit
- ** for 5 minutes longer before disconnect.
- */
-
- main()
- {
- int s;
-
- printf("\nMinutes Online: %d\n", _bye_gettimer());
-
- printf("\nYou now have five minutes left...\n");
-
- _bye_settimeon(5);
- }
-
-
-
-
-
-
-
-
- FUNCTION: void _bye_setname(s)
-
- PARAMETERS: char *s; (ptr to string up to 63 characters)
-
- PURPOSE: This function loads the string pointed to by 's'
- into the resident portion of BYE.COM. This allows
- the ALT-C key to display the caller on line while
- in DOS. The string must be null terminated.
-
- RETURN: void
-
-
-
- FUNCTION: void _bye_getname(s)
-
- PARAMETERS: char *s; (ptr to string up to 63 characters)
-
- PURPOSE: This function loads the buffer pointed to by 's'
- from the resident portion of BYE.COM. This allows
- allows reading the users name currently online by
- other programs while in DOS.
-
- RETURN: void
-
-
-
- EXAMPLE:
-
- #include <stdio.h>
- #include "byexface.h"
-
- /* Allow a 128 bytes of data to collect in the receive data
- ** queue and move it to a local buffer for checksum calculation.
- */
-
- main()
- {
- int i;
- char buf[65];
-
- _bye_setname("John, Doe"); /* set callers name */
-
- /* now read it back */
-
- _bye_getname(buf);
- printf("Caller on line:%s\n", buf);
- }
-
-
-
-
-
-